#version 150

uniform mat4  MVP;
uniform mat4  Model;
uniform vec3  LightDir;
uniform float TextureOffsetX;

// Vertex attribute names are hard coded in the engine
in vec3 Position;
in vec3 Normal;
in vec2 Texture;
in vec3 BonesWeights;
in vec4 BonesIndexesAndTextureNumber;

out vec2 TexCoord;
out float Light;
out float TextureIndex;

void main()
{	
	gl_Position = MVP * vec4(Position, 1.0);
	vec4 PrNormal = Model * vec4(Normal, 0.0); 
	Light = dot( normalize(vec4(LightDir, 0.0)), normalize(PrNormal) );
	TexCoord = Texture;
	TexCoord.x += TextureOffsetX;
	
    TextureIndex = BonesIndexesAndTextureNumber.w;
}
